package v1

import (
	"ginblog/api/common"
	"ginblog/model"
	"ginblog/tools/pagination"
	"ginblog/utils/errmsg"
	"github.com/gin-gonic/gin"
	"github.com/gin-gonic/gin/binding"
)

func GetAllCustom(c *gin.Context) {
	custom := model.CustomPage{}
	_ = c.ShouldBindBodyWith(&custom, binding.JSON)

	page := pagination.Pagination{}
	_ = c.ShouldBindBodyWith(&page, binding.JSON)

	custom.GetAllCustom(&page)
	if custom.GetCode() != 0 {
		common.FailJson(c, custom.GetCode())
		return
	}
	common.SuccessJson(c, errmsg.SUCCESS, page)
}
